<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>线评测系统 - 首页</title>
    <!-- 添加Font Awesome图标库 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
            background-color: #f5f7fa;
            min-height: 100vh;
            display: flex;
            color: #333;
        }

        /* 侧边栏样式 */
        .sidebar {
            width: 240px;
            background: linear-gradient(180deg, #2c3e50, #1a2533);
            color: #fff;
            height: 100vh;
            position: fixed;
            left: 0;
            top: 0;
            overflow-y: auto;
            z-index: 1000;
            box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
            transition: all 0.3s ease;
        }

        .logo-container {
            padding: 20px;
            background: rgba(0, 0, 0, 0.15);
            display: flex;
            align-items: center;
            height: 70px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.08);
            position: relative;
        }

        .logo-container img {
            height: 35px;
        }

        .menu-toggle {
            margin-left: auto;
            cursor: pointer;
            padding: 8px;
            font-size: 18px;
            color: #a3b1c2;
            background: rgba(255, 255, 255, 0.05);
            border-radius: 4px;
            transition: all 0.2s;
        }

        .menu-toggle:hover {
            color: #fff;
            background: rgba(255, 255, 255, 0.1);
        }

        .nav-menu {
            list-style: none;
            padding: 15px 0;
        }

        .nav-item {
            position: relative;
            margin-bottom: 3px;
        }

        .nav-item > a {
            color: #b8c7ce;
            text-decoration: none;
            padding: 12px 25px;
            display: flex;
            align-items: center;
            transition: all 0.3s;
            font-size: 14px;
            position: relative;
            border-left: 4px solid transparent;
        }

        .nav-item > a:hover,
        .nav-item > a.active {
            color: #fff;
            background: rgba(255, 255, 255, 0.08);
            border-left: 4px solid #2ecc71;
        }

        .nav-item > a.active {
            background: rgba(46, 204, 113, 0.15);
        }

        .nav-item .icon {
            margin-right: 12px;
            font-size: 16px;
            width: 20px;
            text-align: center;
            color: #8da9c4;
            transition: transform 0.2s;
        }

        .nav-item > a:hover .icon,
        .nav-item > a.active .icon {
            color: #2ecc71;
            transform: scale(1.1);
        }

        .nav-item.has-submenu > a::after {
            content: '\f105';
            font-family: 'Font Awesome 6 Free';
            font-weight: 900;
            margin-left: auto;
            font-size: 12px;
            transition: all 0.3s;
            opacity: 0.7;
        }

        .nav-item.has-submenu.open > a::after {
            transform: rotate(90deg);
            opacity: 1;
        }

        .submenu {
            list-style: none;
            padding-left: 0;
            display: none;
            background: rgba(0, 0, 0, 0.15);
            border-left: 1px solid rgba(255, 255, 255, 0.05);
            margin-left: 25px;
        }

        .nav-item.open .submenu {
            display: block;
            animation: fadeIn 0.3s ease;
        }

        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(-10px); }
            to { opacity: 1; transform: translateY(0); }
        }

        .submenu .nav-item > a {
            padding: 10px 15px 10px 35px;
            font-size: 13px;
            color: #a3b1c2;
            border-left: none;
            margin-left: 0;
        }

        .submenu .nav-item > a:hover {
            color: #fff;
            background: rgba(255, 255, 255, 0.05);
        }

        .submenu .nav-item > a::before {
            content: '';
            position: absolute;
            left: 20px;
            top: 50%;
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.2);
            transform: translateY(-50%);
            transition: all 0.2s;
        }

        .submenu .nav-item > a:hover::before {
            background: #2ecc71;
            box-shadow: 0 0 5px rgba(46, 204, 113, 0.5);
        }

        /* 添加折叠侧边栏样式 */
        .sidebar.collapsed {
            width: 70px;
        }

        .sidebar.collapsed .logo-text {
            opacity: 0;
            transform: translateX(-20px);
        }

        .sidebar.collapsed .menu-toggle {
            transform: rotate(180deg);
        }

        .sidebar.collapsed .nav-item span {
            display: none;
        }

        .sidebar.collapsed .nav-item > a::after {
            display: none;
        }

        .sidebar.collapsed + .main-content {
            margin-left: 70px;
        }

        .sidebar.collapsed .submenu {
            position: absolute;
            left: 70px;
            top: 0;
            width: 200px;
            margin-left: 0;
            border-left: none;
            border-radius: 0 4px 4px 0;
            background: #2c3e50;
            box-shadow: 5px 0 10px rgba(0, 0, 0, 0.1);
        }

        .sidebar.collapsed .nav-item:hover .submenu {
            display: block;
        }

        /* 添加logo样式 */
        .logo-text {
            color: white;
            font-weight: bold;
            font-size: 22px;
            letter-spacing: 1px;
            transition: all 0.3s;
        }

        .logo-text span {
            color: #2ecc71;
        }

        /* 当侧边栏折叠时，调整顶部栏宽度 */
        .sidebar.collapsed + .main-content .top-bar {
            left: 70px;
        }

        /* 主要内容区域样式 */
        .main-content {
            margin-left: 240px;
            flex: 1;
            padding: 0;
            display: flex;
            flex-direction: column;
            transition: margin-left 0.3s ease;
        }

        /* 顶部栏样式 */
        .top-bar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 25px;
            height: 70px;
            background: #fff;
            border-bottom: 1px solid #eee;
            position: fixed;
            top: 0;
            right: 0;
            left: 240px;
            z-index: 100;
            transition: left 0.3s ease;
            box-shadow: 0 1px 10px rgba(0, 0, 0, 0.05);
        }

        .breadcrumb {
            color: #666;
            font-size: 14px;
            display: flex;
            align-items: center;
        }

        .breadcrumb a {
            color: #333;
            text-decoration: none;
            transition: color 0.2s;
        }

        .breadcrumb a:hover {
            color: #2ecc71;
        }

        .breadcrumb i {
            margin: 0 8px;
            font-size: 12px;
            color: #aaa;
        }

        /* 内容区域样式 */
        .content-wrapper {
            padding: 0;
            flex: 1;
            overflow-y: auto;
            margin-top: 70px; /* 为固定顶部栏腾出空间 */
        }
        
        /* 主内容容器 */
        #main-content-container {
            min-height: calc(100vh - 70px);
            display: block;
            background-color: #f8f9fa;
        }
        
        /* iframe样式 */
        #content-frame {
            width: 100%;
            height: calc(100vh - 70px);
            border: none;
            display: block;
            background-color: #f8f9fa;
        }

        /* 用户菜单样式 */
        .user-menu {
            display: flex;
            align-items: center;
            gap: 15px;
        }

        .notifications, .messages {
            position: relative;
            cursor: pointer;
            width: 36px;
            height: 36px;
            border-radius: 50%;
            background: rgba(46, 204, 113, 0.08);
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s;
        }

        .notifications:hover, .messages:hover {
            background: rgba(46, 204, 113, 0.15);
        }

        .notifications i, .messages i {
            color: #555;
            font-size: 16px;
            transition: color 0.2s;
        }

        .notifications:hover i, .messages:hover i {
            color: #2ecc71;
        }

        .badge {
            position: absolute;
            top: -5px;
            right: -5px;
            background: #e74c3c;
            color: white;
            font-size: 10px;
            font-weight: bold;
            width: 18px;
            height: 18px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            border: 2px solid white;
        }

        .user-avatar {
            width: 38px;
            height: 38px;
            border-radius: 50%;
            background: linear-gradient(135deg, #2ecc71, #1abc9c);
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            color: white;
            font-weight: bold;
            transition: all 0.2s;
            box-shadow: 0 2px 10px rgba(46, 204, 113, 0.2);
        }

        .user-avatar:hover {
            transform: scale(1.05);
            box-shadow: 0 5px 15px rgba(46, 204, 113, 0.3);
        }

        .user-name {
            font-weight: 500;
            color: #444;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 5px;
        }

        .user-name i {
            font-size: 12px;
            color: #888;
            transition: transform 0.2s;
        }

        .user-name:hover i {
            transform: translateY(2px);
        }

        /* 添加页面加载动画 */
        .page-loader {
            text-align: center;
            padding: 50px 0;
            display: none;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            z-index: 100;
        }

        .page-loader i {
            color: #2ecc71;
            font-size: 24px;
            animation: spin 1s linear infinite;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }
    </style>
</head>
<body>
    <!-- 侧边栏 -->
    <nav class="sidebar">
        <div class="logo-container">
            <div class="logo-text">MEGA<span>DIN</span></div>
            <div class="menu-toggle"><i class="fas fa-chevron-left"></i></div>
        </div>
        <ul class="nav-menu">
            <li class="nav-item">
                <a href="#" class="active" data-page="dashboard.html">
                    <i class="icon fas fa-home"></i>
                    <span>首页</span>
                </a>
            </li>
            <li class="nav-item has-submenu">
                <a href="#" data-page="project-application.html">
                    <i class="icon fas fa-file-alt"></i>
                    <span>申报管理</span>
                </a>
                <ul class="submenu">
                    <li class="nav-item">
                        <a href="#" data-page="project-submit.html">项目申报</a>
                    </li>
                    <li class="nav-item">
                        <a href="#" data-page="project-summary.html">申报汇总</a>
                    </li>
                </ul>
            </li>
            <li class="nav-item has-submenu">
                <a href="#" data-page="review-management.html">
                    <i class="icon fas fa-tasks"></i>
                    <span>评审管理</span>
                </a>
                <ul class="submenu">
                    <li class="nav-item">
                        <a href="#" data-page="project-review.html">项目申报评审</a>
                    </li>
                    <li class="nav-item">
                        <a href="#" data-page="review-form.html">评审意见表</a>
                    </li>
                </ul>
            </li>
            <li class="nav-item has-submenu">
                <a href="#" data-page="bidding-management.html">
                    <i class="icon fas fa-clipboard-check"></i>
                    <span>招标管理</span>
                </a>
                <ul class="submenu">
                    <li class="nav-item">
                        <a href="#" data-page="bidding-document.html">招标文件</a>
                    </li>
                    <li class="nav-item">
                        <a href="#" data-page="tender-document.html">投标文件</a>
                    </li>
                    <li class="nav-item">
                        <a href="#" data-page="score-query.html">评分查询</a>
                    </li>
                    <li class="nav-item">
                        <a href="#" data-page="bid-notice.html">中标通知</a>
                    </li>
                    <li class="nav-item">
                        <a href="#" data-page="opening-results.html">开标结果</a>
                    </li>
                </ul>
            </li>
            <li class="nav-item has-submenu">
                <a href="#" data-page="acceptance-management.html">
                    <i class="icon fas fa-check-circle"></i>
                    <span>验收管理</span>
                </a>
                <ul class="submenu">
                    <li class="nav-item">
                        <a href="#" data-page="project-document.html">项目文档</a>
                    </li>
                    <li class="nav-item">
                        <a href="#" data-page="acceptance-application.html">验收申请</a>
                    </li>
                    <li class="nav-item">
                        <a href="#" data-page="acceptance-report.html">验收报告</a>
                    </li>
                </ul>
            </li>
            <li class="nav-item">
                <a href="#" data-page="project-management.html">
                    <i class="icon fas fa-project-diagram"></i>
                    <span>项目管理</span>
                </a>
            </li>
            <li class="nav-item has-submenu">
                <a href="#" data-page="user-management.html">
                    <i class="icon fas fa-users"></i>
                    <span>用户管理</span>
                </a>
                <ul class="submenu">
                    <li class="nav-item">
                        <a href="#" data-page="reviewer-management.html">评审人管理</a>
                    </li>
                    <li class="nav-item">
                        <a href="#" data-page="supplier-management.html">供应商管理</a>
                    </li>
                </ul>
            </li>
            <li class="nav-item has-submenu">
                <a href="#" data-page="system-management.html">
                    <i class="icon fas fa-cog"></i>
                    <span>系统管理</span>
                </a>
                <ul class="submenu">
                    <li class="nav-item">
                        <a href="#" data-page="organization-structure.html">组织架构</a>
                    </li>
                    <li class="nav-item">
                        <a href="#" data-page="role-permission.html">角色权限</a>
                    </li>
                    <li class="nav-item">
                        <a href="#" data-page="module-management.html">模块管理</a>
                    </li>
                    <li class="nav-item">
                        <a href="#" data-page="system-log.html">系统日志</a>
                    </li>
                </ul>
            </li>
             <li class="nav-item has-submenu">
                <a href="#" data-page="project-bidding.html">
                    <i class="icon fas fa-gavel"></i>
                    <span>项目投标</span>
                </a>
                <ul class="submenu">
                    <li class="nav-item">
                        <a href="#" data-page="get-document.html">获取文件</a>
                    </li>
                    <li class="nav-item">
                        <a href="#" data-page="join-bidding.html">参与投标</a>
                    </li>
                    <li class="nav-item">
                        <a href="#" data-page="bidding-result.html">开标结果</a>
                    </li>
                </ul>
            </li>
            <li class="nav-item has-submenu">
                <a href="#" data-page="winning-bidder.html">
                    <i class="icon fas fa-gavel"></i>
                    <span>中标</span>
                </a>
                <ul class="submenu">
                    <li class="nav-item">
                        <a href="#" data-page="notice-of-award.html">中标通知书</a>
                    </li>
                </ul>
            </li>
        </ul>
    </nav>

    <!-- 主要内容区域 -->
    <main class="main-content">
        <div class="top-bar">
            <div class="breadcrumb">
                <a href="index.html"><i class="fas fa-home"></i> 首页</a> <i class="fas fa-angle-right"></i> <span id="current-page">Dashboard</span>
            </div>
            <div class="user-menu">
                <div class="notifications">
                    <i class="fas fa-bell"></i>
                    <span class="badge">3</span>
                </div>
                <div class="messages">
                    <i class="fas fa-envelope"></i>
                    <span class="badge">5</span>
                </div>
                <div class="user-avatar">
                    <i class="fas fa-user"></i>
                </div>
                <span class="user-name">管理员 <i class="fas fa-chevron-down"></i></span>
            </div>
        </div>

        <div class="content-wrapper">
            <!-- 页面加载动画 -->
            <div class="page-loader" id="page-loader">
                <i class="fas fa-spinner"></i>
                <p>内容加载中...</p>
            </div>
            
            <!-- 主内容容器，将被动态填充 -->
            <div id="main-content-container"></div>
            
            <!-- 内容iframe -->
            <iframe id="content-frame" src=""></iframe>
        </div>
    </main>

    <script>
        // 加载页面内容
        function loadPageContent(page) {
            const contentContainer = document.getElementById('main-content-container');
            const contentFrame = document.getElementById('content-frame');
            const loader = document.getElementById('page-loader');
            
            // 如果是首页(dashboard.html)，不加载任何内容，显示空白区域
            if (page === 'dashboard.html') {
                loader.style.display = 'none';
                contentContainer.style.display = 'block';
                contentFrame.style.display = 'none';
                contentContainer.innerHTML = ''; // 清空内容，保持为空白
                return;
            }
            
            // 显示加载动画
            loader.style.display = 'block';
            contentContainer.style.display = 'none';
            contentFrame.style.display = 'block';
            
            // 加载页面
            contentFrame.src = page;
            
            // iframe加载完成后隐藏加载动画
            contentFrame.onload = function() {
                loader.style.display = 'none';
            };
            
            // 处理iframe加载错误
            contentFrame.onerror = function() {
                handleLoadError();
            };
            
            function handleLoadError(error) {
                loader.style.display = 'none';
                contentContainer.style.display = 'block';
                contentFrame.style.display = 'none';
                contentContainer.innerHTML = `
                    <div style="text-align: center; padding: 50px; color: #f44336;">
                        <i class="fas fa-exclamation-triangle" style="font-size: 48px;"></i>
                        <p style="margin-top: 20px;">页面加载失败</p>
                        <p>${error ? error.message : '无法加载请求的页面'}</p>
                    </div>
                `;
            }
        }
        
        // 侧边栏菜单展开/收起功能
        document.querySelectorAll('.has-submenu > a').forEach(item => {
            item.addEventListener('click', (e) => {
                e.preventDefault();
                const parent = item.parentElement;
                
                // 先关闭其他打开的子菜单
                if (!parent.classList.contains('open')) {
                    document.querySelectorAll('.nav-item.has-submenu.open').forEach(openItem => {
                        if (openItem !== parent) {
                            openItem.classList.remove('open');
                        }
                    });
                }
                
                parent.classList.toggle('open');
                
                // 更新面包屑
                updateBreadcrumb(item.querySelector('span').textContent);
            });
        });

        // 菜单切换功能
        document.querySelector('.menu-toggle').addEventListener('click', () => {
            document.querySelector('.sidebar').classList.toggle('collapsed');
        });
        
        // 为所有菜单项添加点击事件
        document.querySelectorAll('.nav-item > a').forEach(item => {
            item.addEventListener('click', function(e) {
                e.preventDefault(); // 阻止默认链接行为
                
                // 清除所有active状态
                document.querySelectorAll('.nav-item > a').forEach(link => {
                    link.classList.remove('active');
                });
                
                // 设置当前点击项为active
                this.classList.add('active');
                
                // 如果是子菜单项，找出父菜单名称
                let parentText = '';
                let menuText = this.querySelector('span') ? this.querySelector('span').textContent : this.textContent;
                
                if (this.closest('.submenu')) {
                    const parentMenu = this.closest('.submenu').previousElementSibling;
                    if (parentMenu) {
                        parentText = parentMenu.querySelector('span') ? parentMenu.querySelector('span').textContent : '';
                    }
                }
                
                // 更新面包屑
                if (parentText) {
                    updateBreadcrumb(parentText, menuText);
                } else {
                    updateBreadcrumb(menuText);
                }
                
                // 根据data-page属性加载对应页面
                const pagePath = this.getAttribute('data-page');
                if (pagePath) {
                    loadPageContent(pagePath);
                } else {
                    loadPageContent('placeholder.html');
                }
            });
        });
        
        // 更新面包屑导航
        function updateBreadcrumb(mainMenu, subMenu = null) {
            const currentPageElement = document.getElementById('current-page');
            
            if (subMenu) {
                currentPageElement.innerHTML = `<a href="#">${mainMenu}</a> <i class="fas fa-angle-right"></i> ${subMenu}`;
            } else {
                currentPageElement.textContent = mainMenu;
            }
        }
        
        // 页面加载完成后，默认显示空白首页
        document.addEventListener('DOMContentLoaded', function() {
            // 直接调用loadPageContent，但不加载任何实际内容
            loadPageContent('dashboard.html');
            
            // 设置首页菜单项为激活状态
            const homeMenuItem = document.querySelector('.nav-item:first-child > a');
            if (homeMenuItem) {
                homeMenuItem.classList.add('active');
            }
            
            // 更新当前页面标题
            document.getElementById('current-page').textContent = '首页';
            
            // 确保内容区域为空白
            document.getElementById('main-content-container').innerHTML = '';
            document.getElementById('content-frame').style.display = 'none';
        });
    </script>
</body>
</html>
